$(function(){
    var all_url = "http://api20.scsj.net.cn";
    var userId = $.cookie("userId");
    var token = $.cookie("token");

  function getUrlParams(name) {
    var search = document.location.search;
    var pattern = new RegExp("[?&]" + name + "\=([^&]+)", "g");
    var matcher = pattern.exec(search);
    var items = null;
    if (null != matcher) {
      try {
        items = decodeURIComponent(decodeURIComponent(matcher[1]));
      } catch (e) {
        try {
          items = decodeURIComponent(matcher[1]);
        } catch (e) {
          items = matcher[1];
        };
      };
    }
    return items;
  };

  // 获取url推广码参数值
  var startDate = getUrlParams("startDate");
    $.ajax({
      data: {userId:userId,token:token,satrtDate:startDate},
      url: all_url+"/banks/popularizeMoneyDetail.do",
      type:'post',
      success:function(data){
        if(data.result.length>0){
          var html=template('expendDetail',data);
          $('.main').html(html);
        }
        else{
          $('.main').html('<div style="text-align:center;color:red;line-height:1.33rem;color:red;height:1.33rem">暂无推广收益</div>');
        }
      },
      error:function(){
        $('.main').html('<div style="text-align:center;color:red;line-height:1.33rem;color:red;height:1.33rem">读取信息错误</div>');
      }
    })
})